package com.example.zjsr.util;


import com.example.zjsr.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledClear {

    @Autowired
    public UserService userService;

    private Logger logger= LoggerFactory.getLogger(ScheduledClear.class);

    @Scheduled(cron = "0 0 0 * * ?")
    public void clearDataJob(){
        userService.deleteUser();//凌晨定时删除用户表中的游客账号和游客整合的数据（先删除整合的数据再删除游客账号）
        logger.info("定时删除游客用户数据");
    }
}
